package com.ubs.training.server.dao.model;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

/**
 * Created with IntelliJ IDEA.
 * User: xubuntu
 * Date: 8/21/12
 * Time: 3:23 AM
 * To change this template use File | Settings | File Templates.
 */
@GenericGenerator(name = "CMSTR_SEQ", strategy = "sequence",
        parameters = {@Parameter(name="sequence", value="cmstr_seq")})
@Entity
public class Employee {
    @GeneratedValue(generator = "CMSTR_SEQ")
    @Id
    @Column(name= "id")
    private int id;
    private String lname;
    private String fname;
    private String pos;
    private String department;


    public String getDepartment() {
        return department;
    }


    public void setDepartment(String department) {
        this.department = department;
    }

    public String getPos() {
        return pos;
    }

    public void setPos(String pos) {
        this.pos = pos;
    }

    public String getLname() {
        return lname;
    }

    public void setLname(String lname) {
        this.lname = lname;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFname() {
        return fname;
    }

    public void setFname(String fname) {
        this.fname = fname;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Employee)) return false;

        Employee employee = (Employee) o;

        if (id != employee.id) return false;
        if (department != null ? !department.equals(employee.department) : employee.department != null) return false;
        if (fname != null ? !fname.equals(employee.fname) : employee.fname != null) return false;
        if (lname != null ? !lname.equals(employee.lname) : employee.lname != null) return false;
        if (pos != null ? !pos.equals(employee.pos) : employee.pos != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (lname != null ? lname.hashCode() : 0);
        result = 31 * result + (fname != null ? fname.hashCode() : 0);
        result = 31 * result + (pos != null ? pos.hashCode() : 0);
        result = 31 * result + (department != null ? department.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id=" + id +
                ", lname='" + lname + '\'' +
                ", fname='" + fname + '\'' +
                ", pos='" + pos + '\'' +
                ", department='" + department + '\'' +
                '}';
    }
}
